﻿function sendAlarm(alarmcalss) {
    CKupdate();
    var f = $('#myalarm');
    var uids = $('#senduser').combotree('getValues');
    var alevel = $('#alarmlevel').val();
    $.messager.progress();

    f.form('submit', {
        url: "../info/GetInfoLinker.ashx?action=adds&uid=" + uids + "&alarmclass=" + alarmcalss,
        onSubmit: function () {
            var isval = $(this).form('validate');
            if (isval == false) $.messager.progress('close');
            return isval;
        },
        success: function (result) {
            $.messager.progress('close');
            if (result.indexOf("T") == 0) {
                $('#dlg').dialog('close');
                $.messager.alert("提示", "恭喜您，信息发送成功", "info");
                $('#tt').datagrid('reload');
            }
            else if ((result.indexOf("F") == 0)) {
                $.messager.alert("提示", "发送失败，请重新操作！", "info");
                return;
            }
            else if ((result.indexOf("L") == 0)) {
                $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                top.location = '/index.aspx';
                return;
            }
        }
    });
}

//预警发送人初始化
function InitSendUser() {
    $('#senduser').combotree({
        url: '../userinfo/GetLinker.ashx?action=queryt',
        multiple: true,
        width: 300,
        valueField: 'id',
        textField: 'text',
        //panelHeight: 'auto'
        panelHeight: 160

    });
    $('#mmark').ckeditor();
    //for (instance in CKEDITOR.instances)
    //    CKEDITOR.instances[instance].setData("");
}

function CKupdate() {
    for (instance in CKEDITOR.instances)
        CKEDITOR.instances[instance].updateElement();
}